<!DOCTYPE html>
<html lang="en">
  <head>
    <title>async provider app</title>
  </head>
  <body>
    <div id="app"></div>
    <script>
      function delay(time = 200){
        return new Promise(resolve => {
          setTimeout(()=>{
            resolve();
          }, time);
        });
      }
      if (typeof __GARFISH_EXPORTS__ !== 'undefined') {
        __GARFISH_EXPORTS__.provider = async () => {
          await delay();
          return {
            render ({ dom , basename }) {
              let newContent = document.createElement('div');
              newContent.setAttribute('id', 'hello-world-async-provider');
              dom.querySelector('#app').appendChild(newContent);
            },

            destroy ({ dom , basename }){
              dom.querySelector('#app').removeChild(dom.querySelector('#hello-world-async-provider'));
            }
          }
        }
      }
    </script>
  </body>
</html>
